<template>
  <div class="h-screen bg-gray-50">
    <the-navbar title="我的买币" left-arrow @click-left="$router.back()" />

    <this-tabs v-model="activeTab" ref="tabs">
      <template #tab0 v-if="activeTab == 0">
        <took-list ref="took-list" @finish="onFinish" @cancel="onCancel" />
      </template>
      <template #tab1 v-if="activeTab == 1">
        <frozen-list ref="frozen-list" @count-down-finish="onCountDonwFinish" />
      </template>
      <template #tab2 v-if="activeTab == 2">
        <done-list ref="done-list" />
      </template>
    </this-tabs>

    <this-dialog ref="dialog" @refresh="refresh0" />
    <the-footer :active="2" />
  </div>
</template>

<script>
import theFooter from '../../components/footer.vue'
import theNavbar from '../../components/navbar.vue'
import thisDialog from './dialog.vue'
import thisTabs from './tabs.vue'
import tookList from './list-took.vue'
import frozenList from './list-frozen.vue'
import doneList from './list-done.vue'

export default {
  components: {
    theFooter,
    theNavbar,
    thisDialog,
    thisTabs,
    tookList,
    frozenList,
    doneList,
  },
  data() {
    return {
      activeTab: 0,
    }
  },
  created() {
    // console.log(this.$store.state.sys.freeze_minutes)
  },
  methods: {
    onFinish(row) {
      this.$refs.dialog.open(row, 'finish')
    },
    onCancel(row) {
      this.$refs.dialog.open(row, 'cancel')
    },
    refresh0() {
      this.$refs['took-list'].onRefresh()
      this.$refs.tabs.getStatis()
    },
    onCountDonwFinish() {
      console.log('count down...')
      this.$refs.tabs.getStatis()
    },
  },
  filter: {},
}
</script>

<style>
</style>